ARG BASE_IMAGE
FROM ${BASE_IMAGE} as builder
#src from here
#FROM anapsix/alpine-java:8_server-jre_unlimited
WORKDIR /app
ARG JAR_FILE=target/*.jar
ADD ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract

ARG BASE_IMAGE
FROM ${BASE_IMAGE}
#RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
COPY --from=builder app/dependencies/ ./
COPY --from=builder app/spring-boot-loader/ ./
COPY --from=builder app/snapshot-dependencies/ ./
COPY --from=builder app/application/ ./

EXPOSE 8080
#ADD ./target/dms-cloud-auto-bid-start-3.5.1.jar ./
#skywalking default
#ENV SKYWALKING_ADDR="skywalking-oap.skywalking:11800"

#CMD java  -javaagent:/skywalking/agent/skywalking-agent.jar -Dskywalking.agent.service_name=auto-bid::auto-bid -Dskywalking.collector.backend_service=skywalking-oap.skywalking:11800  -Dskywalking.trace.ignore_path="GET:/actuator/**,GET:/actuator**" -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom  org.springframework.boot.loader.JarLauncher

RUN chmod +x entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]
